home *** CD-ROM | disk | FTP | other *** search
- #define CURSES_LIBRARY 1
- #include <curses.h>
-
- #ifdef PDCDEBUG
- char *rcsid__rawgetc = "$Header: C:\CURSES\private\RCS\_rawgetc.c 2.1 1993/06/18 20:22:35 MH Rel MH $";
- #endif
-
-
-
-
- /*man-start*********************************************************************
-
- PDC_rawgetch() - Returns the next uninterpreted character (if available).
-
- PDCurses Description:
- Gets a character without any interpretation at all and returns
- it. If keypad mode is active for the designated window,
- function key translation will be performed. Otherwise,
- function keys are ignored. If nodelay mode is active in the
- window, then PDC_rawgetch() returns -1 if no character is
- available.
-
- WARNING: It is unknown whether the FUNCTION key translation
- is performed at this level. --Frotz 911130 BUG
-
- PDCurses Return Value:
- This function returns OK on success and ERR on error.
-
- PDCurses Errors:
- No errors are defined for this function.
-
- Portability:
- PDCurses int PDC_rawgetch( void );
-
- **man-end**********************************************************************/
-
- int PDC_rawgetch(void)
- {
- extern int c_pindex; /* putter index */
- extern int c_gindex; /* getter index */
- extern int c_ungind; /* wungetch() push index */
- extern chtype c_ungch[NUNGETCH]; /* array of ungotten chars */
- extern WINDOW* _getch_win_;
- /* extern WINDOW* w;*/ /* w defined in wgetch() as static - _getch_win_ */
- /* is the same window - all references to w changed*/
- /* to _getch_win_ - marked with @@ */
-
- signed c;
- signed oldc;
-
- #ifdef PDCDEBUG
- if (trace_on) PDC_debug("PDC_rawgetch() - called\n");
- #endif
-
- if (_getch_win_ == (WINDOW *)NULL) /* @@ */
- return( -1 );
-
- #ifdef UNIX
- c = getchar();
- return(c);
- #else
- while (1) /* loop to get valid char */
- {
- c = PDC_get_bios_key();
- oldc = c;
- /*
- * Return the key if it is not a special key.
- */
- if ((c = PDC_validchar(c)) >= 0)
- { /* get & check next char */
- return( c );
- }
- if (_getch_win_->_use_keypad)
- return( oldc );
- }
- #endif
- }
-